<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://"
                + request.getServerName() + ":" + request.getServerPort()
                + path;
    %>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>图片分享后台</title>
    <!-- 基本配置文件会先放在前面 -->
    <link rel="stylesheet" type="text/css" href="../resources/package/bootstrap/css/bootstrap.css">
    <%--<link rel="stylesheet" type="text/css" href="../resources/package/font-awesome-4.7.0/css/font-awesome.min.css">--%>
    <link rel="stylesheet" type="text/css" href="../resources/manager/css/base.css">
    <%--<link rel="stylesheet" type="text/css" href="../resources/manager/css/form.css">--%>
    <link rel="stylesheet" type="text/css" href="../resources/manager/css/examine.css">
    <link rel="stylesheet" href=" ../resources/package/layui/css/layui.css" media="all">

    <script type="text/javascript" src="../resources/package/jquery/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="../resources/package/layer/layer.js"></script>
    <script type="text/javascript" src="  ../resources/package/layui/layui.js"></script>
    <script type="text/javascript" src="../resources/package/bootstrap/js/bootstrap.min.js"></script>
    <script>
        $(function () {
            $(".examineResultBtn").click(function () {
                let that = $(this);
                console.log(that.val());
                console.log($(".examineResultContent").val());
                $.ajax({
                    type: "GET",
                    url: "<%=basePath%>/admin/dealExamineResult",
                    data: {
                        abuseId: that.val(),
                        content: $(".examineResultContent").val(),
                        result:$("#abuseResultValue").val()
                    },
                    xhrFields: {
                        withCredentials: true
                    },
                    crossDomain: true,
                    dataType: "text",
                    success: function (data) {
                        console.log(data);
//                        window.parent.location.reload();//刷新父页面
                        layer.msg('操作成功', {
                            time: 500
                        });
                    },
                    error: function (data) {
                        console.log(data);
                        layer.msg('操作失败', {
                            time: 500
                        });
                    }
                });
            });
            $(".modalBtn").click(function () {
                if ($(this).val() == 1) {
                    $("#myModalLabel").replaceWith("<h4 class='modal-title' id='myModalLabel'>通知被举报者：${abuseDetailResult.account}</h4>")
                    $("#abuseResultValue").val(1);
                } else {
                    $("#myModalLabel").replaceWith("<h4 class='modal-title' id='myModalLabel'>通知举报者:${abuseDetailResult.informerAccount}</h4>")
                    $("#abuseResultValue").val(2);
                }
            });
        });
    </script>
</head>
<body>
<div class="content-wrapper">
    <div class="right-inner">
        <div class="one-cont cont">
            <div class="cont-inner share">
                <div class="share-header">
                    <a class="logo">
                        <img src="${abuseDetailResult.portraitThumbPath}">
                    </a>
                    <a class="name">${abuseDetailResult.account}</a>
                    <a class="icon"><i class="fa fa-angle-right"></i></a>
                    <a class="property">
                        <fmt:formatDate value="${abuseDetailResult.shareTime}" pattern="yyyy-MM-dd hh:mm:ss" type="date" dateStyle="long"/>
                        <fmt:formatDate value="${abuseDetailResult.commentTime}" pattern="yyyy-MM-dd hh:mm:ss" type="date" dateStyle="long"/>
                    </a>
                    <a class="ShareDetail " style="color: #00B7FF">查看分享来源 &nbsp;<span class="glyphicon glyphicon-share"></span> </a>
                    <div class="share-content">${abuseDetailResult.description}</div>
                    <div class="share-header-bottom"></div>
                </div>
                <c:if test="${not empty abuseDetailResult.shareTime}">
                    <div class="layui-carousel" id="sharePhotos">
                        <!-- 条目中可以是任意内容，如：<img src=""> -->
                        <div carousel-item>
                            <c:forEach var="img" items="${abuseDetailResult.imagesThumbPath}">
                                <div class="share-photo">
                                    <img src="${img}">
                                </div>
                            </c:forEach>
                        </div>
                    </div>
                </c:if>
                <c:if test="${not empty abuseDetailResult.commentTime}">
                    <div class="share-photo-title"><span style="color: #d58512">评论内容：</span>${abuseDetailResult.commentContent}</div>
                </c:if>
                <div class="share-header-bottom"></div>
                <div class="share-photo-title">
                    <label class="" style="color: #b9171b">举报原因:</label><br/>
                    <textarea class="" style="width: 100%;height: 100px;border-radius: 4px;background-color: #afd9ee"
                              readonly>${abuseDetailResult.reason}</textarea>
                </div>
                <div class="share-header-bottom"></div>
                <div class="share-photo-title">
                    <label class="" style="color: #d58512;width: 30%">审核结果:</label>
                    <div class="examineResultDiv">
                        <input  type="radio" name="radio" value="1" class="modalBtn"
                                <c:if test="${abuseDetailResult.result==0}">data-toggle="modal" data-target="#myModal" </c:if>
                                <c:if test="${abuseDetailResult.result!=0}">disabled</c:if>
                                <c:if test="${abuseDetailResult.result==1}">checked</c:if> >
                        <span style="color: #00B7FF">通过</span>
                    </div>
                    <div class="examineResultDiv">
                        <input type="radio" name="radio" value="2" class="modalBtn"
                               <c:if test="${abuseDetailResult.result==0}">data-toggle="modal" data-target="#myModal" </c:if>
                               <c:if test="${abuseDetailResult.result!=0}">disabled</c:if>
                               <c:if test="${abuseDetailResult.result==2}">checked</c:if> >
                        <span style="color: #b92c28">拒绝</span>
                    </div>
                </div>

                <!-- 模态框（Modal） -->
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                     aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                    &times;
                                </button>
                                <h4 class="modal-title" id="myModalLabel">通知被举报者</h4>
                            </div>
                            <div class="modal-body">
                                <label style="color: #d58512">通知内容:</label><br/>
                                <textarea class="examineResultContent"
                                          style="width: 100%;height: 100px;border-radius: 4px;background-color: #afd9ee"></textarea>
                            </div>
                            <input type="hidden" id="abuseResultValue">
                            <div class="modal-footer">
                                <button type="button" class="btn btn-primary examineResultBtn"
                                        value="${abuseDetailResult.abuseId}" data-dismiss="modal">完成
                                </button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal -->
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use('carousel', function () {
        var carousel = layui.carousel;
        //建造实例
        carousel.render({
            elem: '#sharePhotos'
            , width: '100%' //设置容器宽度
            , arrow: 'always' //始终显示箭头
            //,anim: 'updown' //切换动画方式
        });
    });
</script>
<script src="../resources/manager/js/app/base.js"></script>
<script src="../resources/manager/js/app/tool.js"></script>
<script src="../resources/manager/js/app/fade.js"></script>
<script src="../resources/manager/js/app/shareFunction.js"></script>
</html>